<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8" />
		<meta http-equiv="X-UA-Compatible" content="IE=edge" />
		<meta name="keywords" content="sortable, reorder, list, javascript, html5, drag and drop, dnd, animation, groups, angular, ng-sortable, react, mixin, effects, rubaxa" />
		<meta name="viewport" content="width=device-width, initial-scale=0.5" />
		<style>
      body {
        font-family: arial;
        background: rgb(242, 244, 246);
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
      }

      h3 {
        color: rgb(199, 204, 209);
        font-size: 28px;
        text-align: center;
      }

      #elements-container {
        text-align: center;
      }

      .draggable-element {
        display: inline-block;
        width: 200px;
        height: 200px;
        background: white;
        border: 1px solid rgb(196, 196, 196);
        line-height: 200px;
        text-align: center;
        margin: 10px;
        color: rgb(51, 51, 51);
        font-size: 30px;
        cursor: move;
      }

      .drag-list {
        width: 400px;
        margin: 0 auto;
      }

      .drag-list > li {
        float: left;
        list-style: none;
        background: rgb(255, 255, 255);
        border: 1px solid rgb(196, 196, 196);
        margin: 5px 0;
        font-size: 24px;
      }

      .drag-list .title {
        display: inline-block;
        width: 75px;
        padding: 6px 6px 6px 12px;
        vertical-align: top;
        font-size: 0.5rem;
        }

      .drag-list .drag-area {
        display: inline-block;
        background: rgb(158, 211, 179);
        width: 60px;
        height: 28px;
        vertical-align: top;
        float: right;
        cursor: move;
      }
      .sb1{
      	 display: inline-block;
      	  padding: 6px 6px 6px 12px;
      }
       .sb2{
      	 display: inline-block;
      	  padding: 6px 6px 6px 60px;
      	    text-align: center;
      }
       .sb3{
      	 display: inline-block;
      	  padding: 6px 6px 6px 45px;
      	    text-align: center;
      }
	.move{
		font-size: 17px;
	}
	.title2{
		display: inline-block;
        width: 100px;
        padding: 6px 6px 6px 15px;
        vertical-align: top;
        font-size: 0.5rem;
        text-align: center;
	}
	.title3{
		display: inline-block;
        width: 60px;
        padding: 6px 6px 6px 19px;
        vertical-align: top;
        font-size: 0.5rem;
	}

    </style>
	</head>

	<body>
      <div>
        <ul id="foo" class="drag-list">
          <li><span>小乙0:</span><span>0</span></li>
          <li><span>小乙1:</span><span>1</span></li>
          <li><span>小乙2:</span><span>2</span></li>
          <li><span>小乙3:</span><span>3</span></li>
          <li><span>小乙4:</span><span>4</span></li>
          <li><span>小乙5:</span><span>5</span></li>
          <li><span>小乙6:</span><span>6</span></li>
          <li><span>小乙7:</span><span>7</span></li>
          <li><span>小乙8:</span><span>8</span></li>
          <li><span>小乙9:</span><span>9</span></li>
          
        </ul>

      </div>



			<script src="js/Sortable.js"></script>
      <!-- <script src="js/app.js"></script> -->
      <script src="js/jquery-3.1.1.min.js"></script>

	</body>
<script>

 
Sortable.create($("#foo")[0], {
		group: "foo",
		animation: 150,
		onAdd: function (evt){ console.log('onAdd.foo:', [evt.item, evt.from]); },
		onUpdate: function (evt){ console.log('onUpdate.foo:', [evt.item, evt.from]); },
		onRemove: function (evt){ console.log('onRemove.foo:', [evt.item, evt.from]); },
		onStart:function(evt){ console.log('onStart.foo:', [evt.item, evt.from]);},
		onSort:function(evt){ console.log('onStart.foo:', [evt.item, evt.from]);},
    onEnd: function(evt){ 
      console.log('onEnd.foo:', [evt.item, evt.from]);
      // 对数据进行排序
      console.log($("#foo > li").each(function(index,item,ul){
          $($(item).find("span")[1]).html(index)
      }));
    }
	});


</script>
</html>